<?php
/**
* 名称：主页控制器。
* 描述：主页的控制响应程式。
*/
final class Controller_Index extends Controller{
    /**
    * 描述：入口程式。
    * @access protected
    * @return void
    */
    protected function Main(){
        $data=array(
            'base'=>array(
                'newsHot'=>Model_News::GetDataForHot(),  //热门新闻
                'news0002'=>Model_News::GetDataX0002(), //政策法规
                'news0003'=>Model_News::GetDataX0003(), //综合
                'news0004'=>Model_News::GetDataX0004(), //船舶(集)
                'news0005'=>Model_News::GetDataX0005(), //集装箱
                'news0006'=>Model_News::GetDataX0006(), //冶金
                'news0007'=>Model_News::GetDataX0007(), //钢铁
                'news0008'=>Model_News::GetDataX0008(), //煤炭
                'news0009'=>Model_News::GetDataX0009(), //化工
                'news0010'=>Model_News::GetDataX0010(), //石油
                'news0011'=>Model_News::GetDataX0011(), //民生
                'news0012'=>Model_News::GetDataX0012(), //期货
                'news0013'=>Model_News::GetDataX0013(), //国内
                'news0014'=>Model_News::GetDataX0014(), //国际
                'news0017'=>Model_News::GetDataX0017(), //头条
                'news0018'=>Model_News::GetDataX0018(), //要闻
                //~
                'IRRS0001'=>Model_IRRS::GetDataX0001(7), //内参信息
                //~
                'exhibition0001'=>Model_Exhibition::GetDataX0001(), //合作展会
                //~
                'ad'=>Model_Ad::Index(),
                'slide'=>Model_Slide::Index(),
                //~
                'disperse'=>array(
                    'link'=>array(
                        'yewu'=>Route::MakeHyperlink(':page::detail',array('label'=>'yewu'))
                    )
                )
            )
        );
//        print_r($data['base']['n0001']);
//exit();
        //~
        self::$Template->Assign('data',$data);
        self::$Template->Display('index.html');
    }

    /**
    * 描述：绑定横幅幻灯片数据。
    * @access protected
    * @return void
    */
    protected function Slide(){
        $data=self::$Database->GetAll('SELECT * FROM '.self::$Database->Table('slide').' WHERE type=\'index\' ORDER BY id DESC LIMIT 0,5'); //,7,8
        $xml='<?xml version="1.0" encoding="utf-8"?>';
        $xml.='<bcaster autoPlayTime="3">';
        foreach ($data as $row) {
            $xml.='<item item_url="/data/000/slide/'.$row['picture'].'" link="'.$row['link'].'"></item>';
        }
        $xml.='</bcaster>';
        //~
        header("Content-type:text/xml");
        echo $xml;
    }
}